<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <!-- 李义根 -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="keywords" content="jquery,ui,easy,easyui,web">
<meta name="description" content="easyui help you build your web page easily!">
<link rel="stylesheet" type="text/css" href="../js/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../js/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="../js/easyui/demo/demo.css">
<link rel="stylesheet" type="text/css" href="../css/ticket.css">
<script type="text/javascript" src="../js/easyui/jquery.min.js"></script>
<script type="text/javascript" src="../js/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../js/easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript">
var url;
<!--修改 -->
function select() {
	var row=$('#dg').datagrid('getSelected');
	if(row){
		/* $('#dlg').dialog('open').dialog('setTitle', '修改 '); */
		/* $('#fm').form('load'); */ 
		 var num=row['oid'];  
		 var sp=row["splace"];
		 var ep=row["eplace"];
		 url="editorder.jsp?oid="+num;
		 /* url="editorder.jsp?oid="+num; */
		 window.location.href=url;
		 
	}
	
}
<!--保存 -->
function saveorder() {
	$('#fm').form('submit', {
		url : url,
		onSubmit : function() {
			return $(this).form('validate');
		},
		success : function(result) {

			var date = eval('(' + result + ')');
			if (date.success) {
				$('#dlg').dialog('close'); // close the dialog
				$('#dg').datagrid('reload'); // reload the user data
			} else {
				$.messager.show({
					title : 'Error',
					msg : result.msg
				});
			}
		}
	});
}
<!--删除 -->
function removeorder() {
	var row = $('#dg').datagrid('getSelected');
	if (row) {
		$.messager.confirm('提示！',
				'确定要删除该信息吗？ ', function(r) {
					if (r) {
						var num=row['oid']; 
						$.post('../orderServlet?param=delete&oid='+num,
								function(result) {
							if (result.success) {
								window.opener.location.reload();//刷新页面 
								$('#dg').datagrid('reload'); // reload the  data
							} else {
								$.messager.show({ // show error message
									title : 'Error',
									msg : result.msg
								});
							}
						}, 'json');
					}
				});
	} 
}

Date.prototype.format = function(format) {  
    var o = {  
        "M+": this.getMonth() + 1, // month  
        "d+": this.getDate(), // day  
        "h+": this.getHours(), // hour  
        "m+": this.getMinutes(), // minute  
        "s+": this.getSeconds(), // second  
        "q+": Math.floor((this.getMonth() + 3) / 3), 
        "S": this.getMilliseconds()  
        // millisecond  
    }  
    if (/(y+)/.test(format))  
        format = format.replace(RegExp.$1, (this.getFullYear() + "")  
            .substr(4 - RegExp.$1.length));  
    for (var k in o)  
        if (new RegExp("(" + k + ")").test(format))  
            format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));  
    return format;  
}  
 
$(document).ready(function () {
	$('#dg').datagrid({
	    pagination:true,
	    fitColumns:true,
	    singleSelect:true,
	    rownumbers:true,
	    url:'../selectOrderServlet?param=select',
	    columns:[[
	    	{field:'oid',title:'订单号',width:120},
        	{field:'times',title:'出发时间',width:160,formatter:formatDatebox},
            {field:'osplace',title:'出发站',width:100},
            {field:'oeplace',title:'到达站',width:100},
            {field:'train',title:'车次',width:100},
            {field:'seat',title:'座位号',width:100},
            {field:'rname',title:'乘客姓名',width:100},
            {field:'cardType',title:'证件类型',width:100},
            {field:'type',title:'旅客类型',width:100},
            {field:'price',title:'票价',width:100,align:'right'}
	    ]]
	});

function formatDatebox(value) {  
    if (value == null || value == '') {  
        return '';  
    }  
    var dt;  
    if (value instanceof Date) {  
        dt = value;  
    } else {  
        dt = new Date(value);  
    }  
  
    return dt.format("yyyy-MM-dd hh:mm:ss"); //扩展的Date的format方法(上述插件实现)   
}
});
$(document).ready(function () {
 var p = $('#dg').datagrid('getPager');  
                $(p).pagination({  
                pageSize: 10,//每页显示的记录条数，默认为5  
                pageList: [10, 20 ,30],//可以设置每页记录条数的列表  
                beforePageText: '第',//页数文本框前显示的汉字  
                afterPageText: '页    共 {pages} 页',  
                displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录'
            });  

}); 

</script>
<title>查询订单</title>
</head>
<body>
<div><div id="top" >
   <table width="100%"  align="center">
  <tr>
    <td width="1411" colspan="2" background="../images/ny_top_img_bg.gif"><img src="../images/ny_top_img.gif" width="650" height="108"></td>
    </tr>
 </table>
	</div>
  <div id="navi" >
  	<span id="cr">当前选择》》订单查询</span>
	<span id="user">欢迎您${sessionScope.username},退出</span>
  </div>
  <div id="menu">
  <table width="247">
  
	<tr>
	<td width="75">&nbsp;</td>
	<td width="165" height="35"><span class="text_blod">用户</span></td></tr>
	<tr>
	<td ><img src="../images/ny_arrow1.gif"></td>
    <td height="35" class="text_cray">车票预订</td>
	</tr>
	<tr><td ><img src="../images/ny_arrow1.gif"></td>
    <td height="35" class="text_cray">个人信息</td></tr>
	<tr><td ><img src="../images/ny_arrow1.gif"></td>
    <td height="35" class="text_cray"><a href="../orders/showorder.jsp">订单详情</a></td></tr>

  
  </table>
  
  </div>
	<h1>订单详情</h1>
	 

	<div class="demo-info" style="margin-bottom: 10px">
		<div class="demo-tip icon-tip"> </div>
		<div>点击下面的功能按钮，实现对票务的操作</div>
	</div>
	<table id="dg" title="订单管理" class="easyui-datagrid"
		style="width: 1041px; height: 430px" toolbar='#toolbar',>

	</table>
	<div id="toolbar">
		<a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="select()">修改</a> 
		
			<a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="removeorder()">删除</a>
	</div>

	 </div>


</body>
</html>
